package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface OrderDao {
    public void add(Order order);
    public List<Order> findByCondition(Order order);
    public Map findById4Detail(Integer id);
    public Integer findOrderCountByDate(String date);
    public Integer findOrderCountAfterDate(String date);
    public Integer findVisitsCountByDate(String date);
    public Integer findVisitsCountAfterDate(String date);
    public List<Map> findHotSetmeal();
    public void deleteByAddrId(Integer addressId);

    //########################################################################################
    List<Map<String,Object>> getOrderCountAndDaysByCondition(@Param("begin") String begin, @Param("end") String end);
    List<Integer> getVisitCountByCondition(@Param("begin") String begin, @Param("end") String end);
    /**
     * 查询所有预约记录
     * @return
     */
    List<Map> findAllOrderRecord(@Param("phoneNum") String phoneNum,@Param("startDate") String startDate,@Param("endDate") String endDate);

    /**
     * 根据id查询预约订单详细信息
     * @param id
     * @return
     */
    Map findOrderDetailsById(Integer id);



    Page<Order> selectByCondition(String startDate, String orderDate, String orderType, String orderStatus, String queryString);
    Map findAllById(Integer id);

    void edit(Order order);
    void deleteById(Integer id);

    void changeStatus(Order order);

    Order checksame(@Param("memberId") Integer memberId,@Param("orderDate") Date orderDate, @Param("setmealId")Integer setmealId);

    List<Order> findAllsetmealByMemberId(Integer Id);

    @Select("select count(*) from t_order where setmeal_id = #{setmealId}")
    int getCountSetmeal(Integer setmealId);

    List<Order> queryBySetmealId(Integer setmealId);
}
